{include file="public/header" /}
            <div class="tab-right">
				        <div>
					          <form class="form-horizontal" id="infomation" name="infomation" method="post" action="{:url('infomation')}">
                        <div class="form-group">
                            <label class="col-xs-2 uc-control-label">昵称：</label>
                            <div class="col-xs-10 my-input">
                                <input type="text" id="username" class="form-control ucenter_form_data uc-input-long" value="{$data.username}" name="username" placeholder="请输入昵称" lay-key="1">
                            </div>
                        </div>

                        <input type="hidden" name="sex" value="1" id="sex">
    					          <div class="form-group form-group-text">
              							<label class="col-xs-2 uc-control-label">性别：</label>
              							<div class="col-xs-10 my-input my-radio">
                								<label class="radio-inline cur"><i></i><input class="ucenter_form_data" type="radio" name="xinbie" value="1">男</label>
                								<label class="radio-inline"><i></i><input class="ucenter_form_data" type="radio" name="xinbie" value="2">女</label>
              							</div>
    					          </div>

            						<div class="form-group">
              							<label class="col-xs-2 uc-control-label">年龄：</label>
              							<div class="col-xs-10 my-input">
              						      <input type="number" id="age" class="form-control ucenter_form_data uc-input-long" value="{$data.age}" name="age" placeholder="请输入年龄" lay-key="1">
              							</div>
            						</div>

    				            <div class="form-group select-addres">
                            <label class="col-xs-2 uc-control-label">所在地：</label>
                            <!-- 地址地址地址地址地址地址地址地址地址 -->
                            <div class="col-xs-10 my-input">
                                <select id="s_province" class="form-control ucenter_form_data" name="s_province">
                                  <!-- <option value="0">请选择</option> -->
                                </select>
                                <select id="s_city" class="form-control ucenter_form_data" name="s_city">
                                    <option value="0">请选择</option>
                                </select>

                                <select id="seachdistrict" class="form-control hide" style="display: none !important;"></select>
                            </div>
                            <script>
                              var s = ['s_province', 's_city'];
                              _init_area();
                            </script>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2 uc-control-label"> 联系QQ：</label>
                            <div class="col-xs-10 my-input">
                                <input type="text" id="qq" class="form-control ucenter_form_data uc-input-long" maxlength="11" autocomplete="off" name="qq" value="{$data.qq}" placeholder="QQ和微信最少要填写一项">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-xs-2 uc-control-label"> 联系微信：</label>
                            <div class="col-xs-10 my-input">
                                <input type="text" id="weixin" class="form-control ucenter_form_data uc-input-long" maxlength="11" autocomplete="off" name="weixin" value="{$data.weixin}" placeholder="QQ和微信最少要填写一项">
                            </div>
                        </div>

                        <div class="uc-info-title"></div>
                        <div class="form-group">
                            <label class="col-xs-2 uc-control-label"></label>
                            <div class="col-xs-5 form-group-sub">
                                <button data-action="/set/set-info.html" type="submit" class="fl btn btn-primary ucenter_form_info_submit">确认并保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    $('title').html('个人信息');
    var sex = {$data.sex};
    $('input[name="xinbie"]').parent().removeClass('cur');
    // 遍历input
    var numArr = new Array();
    $('input[name="xinbie"]').each(function(){
        var vll=$(this).val();
        if(sex){
            if(vll==sex){
                $(this).parent(".radio-inline").addClass('cur')
            }
        }else{
          if(vll==1){
              $(this).parent(".radio-inline").addClass('cur')
          }
        }
    });

    $(".radio-inline").on("click", function () {
        $(this).addClass("cur");
        $(this).siblings("label").removeClass("cur");
        $('#sex').val($('input[name="xinbie"]:checked').val());
    })
</script>
<script src="__STATIC__/js/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script>
    //提交
    $(function(){
        $('#infomation').ajaxForm({
            beforeSubmit: checkForm,
            success: complete,
            dataType: 'json'
        });

        function checkForm(){
            if( '' == $.trim($('#username').val())){
                layer.msg('请输入昵称',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if( '' == $.trim($('#age').val())){
                layer.msg('请输入年龄',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if( '省份' == $.trim($('#s_province').val()) || '地级市' == $.trim($('#s_city').val())){
                layer.msg('请输入所在地',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }

            if( '' == $.trim($('#qq').val()) && '' == $.trim($('#weixin').val())){
                layer.msg('QQ和微信最少要填写一项',{icon:2,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
        }


        function complete(data){
            if(data.code==1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    window.location.href="{:url('index')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                return false;
            }
        }

    });
</script>
</html>
